package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateBusinessChargeDTO;
import com.itlong.cloud.POJO.VO.operate.OperateBusinessChargeVO;
import com.itlong.cloud.POJO.VO.operate.OperateBusinessDeviceVO;
import com.itlong.cloud.POJO.VO.operate.OperateBusinessOperationLogVO;
import com.itlong.cloud.POJO.VO.operate.OperatePropertyInformationGetVO;
import com.itlong.cloud.operate.service.IOperateBusinessChargeService;
import com.itlong.cloud.paymenthub.IOperateBusinessChargeServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      运营-商务收费管理暴露接口实现类
 * </desc>
 *
 * @createDate 2019/08/06
 */
@RestController
public class OperateBusinessChargeServiceResource implements IOperateBusinessChargeServiceClient {

    @Autowired
    private IOperateBusinessChargeService iOperateBusinessChargeService;

    /**
     * <desc>
     *      分页获取商务收费信息
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 商务收费信息
     * @author wangzhi
     * @createDate 2019/08/06
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/getPage")
    public Page<OperateBusinessChargeVO> getPage(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.getPage(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      获取商务收费信息详情
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 商务收费信息详情
     * @author wangzhi
     * @createDate 2019/08/06
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/getOne")
    public List<OperateBusinessChargeVO> getOne(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.getOne(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      添加商务收费信息
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 0失败 1成功 99项目已存在
     * @author wangzhi
     * @createDate 2019/08/07
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/save")
    public Integer save(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.save(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      修改商务收费信息
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 0失败 1成功
     * @author wangzhi
     * @createDate 2019/08/07
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/update")
    public Integer update(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.update(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      删除商务收费信息
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 受影响行数，大于0则成功
     * @author wangzhi
     * @createDate 2019/08/07
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/delete")
    public Integer delete(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.delete(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      查询物业信息
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 物业信息
     * @author wangzhi
     * @createDate 2019/08/07
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/getPropertyInformation")
    public OperatePropertyInformationGetVO getPropertyInformation(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.getPropertyInformation(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      获取商务收费信息附加信息
     * </desc>
     *
     * @param operateBusinessChargeDTO 财务续费审批DTO
     * @return 商务收费信息附加信息
     * @author wangzhi
     * @createDate 2019/08/15
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/getAppendInfo")
    public Map<String, Object> getAppendInfo(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.getAppendInfo(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      获取该批次号已录入数据的最大结束时间
     * </desc>
     *
     * @return 该批次号已录入数据的最大结束时间
     * @author wangzhi
     * @createDate 2019/11/25
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/getMaxEndTime")
    public Map<String, Object> getMaxEndTime(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.getMaxEndTime(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      审核商务收费信息
     * </desc>
     *
     * @return 标准格式化响应结果
     * @author wangzhi
     * @createDate 2019/11/26
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/audit")
    public Integer audit(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.audit(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      获取业务日志列表
     * </desc>
     *
     * @return 业务日志列表
     * @author wangzhi
     * @createDate 2019/11/26
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/getLogPage")
    public Page<OperateBusinessOperationLogVO> getLogPage(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.getLogPage(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      获取设备详情列表
     * </desc>
     *
     * @return 设备详情列表
     * @author wangzhi
     * @createDate 2019/11/26
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/getDevicePage")
    public Page<OperateBusinessDeviceVO> getDevicePage(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception {
        return iOperateBusinessChargeService.getDevicePage(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      商务延期处理
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 标准格式化响应结果
     * @author Juguang.S
     * @createDate 2020/11/26
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/delay")
    public void delay(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception{
        iOperateBusinessChargeService.delay(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      商务收款确认
     * </desc>
     *
     * @param operateBusinessChargeDTO 商务收费信息DTO
     * @return 标准格式化响应结果
     * @author Juguang.S
     * @createDate 2020/11/26
     */
    @Override
    @PostMapping(path = "/operate/businessCharge/confirm")
    public void confirm(@RequestBody OperateBusinessChargeDTO operateBusinessChargeDTO) throws Exception{
        iOperateBusinessChargeService.confirm(operateBusinessChargeDTO);
    }

    /**
     * <desc>
     *      获取项目下可用的批次号列表
     * </desc>
     *
     * @param projectId 项目id
     * @return
     * @Author Zhu.yj
     * @createDate  2021/1/4
     */
    @Override
    @PostMapping("/operate/businessCharge/getProjectBatchNumber")
    public List<String> getProjectBatchNumber(@RequestParam("projectId") String projectId) throws Exception {
        return iOperateBusinessChargeService.getProjectBatchNumber(projectId);
    }
}
